package com.ljf.framework.context;

import com.ljf.framework.LjfManager;

/**
 * 说明：
 *
 * @Auther: lijinfeng
 * @Date: 2024/8/22
 */
public class LjfContextSync {
    /**
     * 写入上下文对象
     */
    public static void setContext(LjfContext ljfContext) {
        LjfManager.setLjfTempContext(ljfContext);
    }

    /**
     * 获取上下文对象
     * @return see note
     */
    public static LjfContext getContext() {
        LjfContext ljfTempContext = LjfManager.getLjfTempContext();
        if (ljfTempContext == null){
            ljfTempContext = LjfManager.getLjfContext();
            setContext(ljfTempContext);
        }
        return ljfTempContext;
    }

    /**
     * 清除上下文对象
     */
    public static void clearContext() {
        LjfManager.setLjfTempContext(null);
    }
}
